import Taro, {Component} from '@tarojs/taro'
import {connect} from '@tarojs/redux'
import {View} from '@tarojs/components'
import './index.less'

@connect(({businessReleaseHome, loading}) => ({
  businessReleaseHome,
  loading
}))

export default class InformRelease extends Component {

  config = {
    navigationBarTitleText: '信息发布'
  }

  constructor(props) {
    super(props)
    this.state = {}
  }

  componentWillMount() {
  }

  componentDidMount() {
  }

  componentWillUnmount() {
  }

  componentDidShow() {
  }

  componentDidHide() {
  }

  // 页面跳转
  goPage(page){
    Taro.navigateTo({
      url: `/pages/${page}/index`
    })
  }

  render() {
    const { businessReleaseHome } = this.props;
    const { tabList } = businessReleaseHome;

    return (
      <View className='informRelease'>
        {
          tabList.map(item => <View className='box' onClick={this.goPage.bind(this, item.path)} >
            <image src={`../../images/business/${item.path}.png`} mode="widthFix"/>
            <View>{item.name}</View>
          </View>)
        }
      </View>
    )
  }
}
